﻿namespace Amazon.Checkout.Handlers
{
    using JetBrains.Annotations;
    using Models;

    using Orchard.ContentManagement;
    using Orchard.ContentManagement.Handlers;
    using Orchard.Data;
    using Orchard.Localization;

    [UsedImplicitly]
    public class CheckoutByAmazonSettingsPartHandler : ContentHandler
    {
        public CheckoutByAmazonSettingsPartHandler(IRepository<SiteSettingsPartRecord> repository)
        {
            this.T = NullLocalizer.Instance;

            Filters.Add(new ActivatingFilter<SiteSettingsPart>("Site"));
            Filters.Add(StorageFilter.For(repository));
        }

        public Localizer T { get; set; }

        protected override void GetItemMetadata(GetContentItemMetadataContext context)
        {
            if (context.ContentItem.ContentType != "Site")
            {
                return;
            }

            base.GetItemMetadata(context);
        }
    }
}